from nmj.sqlite.base_item import DatabaseItem
from nmj.tools.ordereddict import OrderedDict
import re

class App(DatabaseItem):
	TABLE = "APP"
	FIELDS = OrderedDict([
		("APP_ID", "INTEGER"), ("VERSION_ID", "INTEGER"), ("NAME", "TEXT"),
		("DESCRIPTION", "TEXT"), ("AUTHOR", "TEXT"), ("VERSION", "TEXT"),
		("PATH", "TEXT"), ("WIDGET_PATH", "TEXT"), ("WIDGET_STATUS", "INTEGER"),
		("THUMBNAIL_EXTENSION", "TEXT"), ("PRIORITY", "INTEGER"),
	])
	DEFAULTS = {

	}


class AppCategory(DatabaseItem):
	TABLE = "APP_CATEGORY"
	FIELDS = OrderedDict([
		("APP_CATEGORY_ID", "INTEGER"), ("NAME", "TEXT"), ("CODE", "TEXT"),
	])
	DEFAULTS = {

	}


class AppToCategory(DatabaseItem):
	TABLE = "APP_TO_CATEGORY"
	FIELDS = OrderedDict([
		("APP_TO_CATEGORY_ID", "INTEGER"), ("APP_ID", "INTEGER"), ("APP_CATEGORY_ID", "INTEGER"),
	])
	DEFAULTS = {

	}


class DbVersion(DatabaseItem):
	TABLE = "DB_VERSION"
	FIELDS = OrderedDict([
		("DB_VERSION_ID", "INTEGER"), ("VERSION", "TEXT"), ("DB_VERSION1", "TEXT"),
		("DB_VERSION2", "TEXT"), ("DB_VERSION3", "TEXT"), ("DB_VERSION4", "TEXT"),
		("DB_VERSION5", "TEXT"),
	])
	DEFAULTS = {

	}


class Favourite(DatabaseItem):
	TABLE = "FAVOURITE"
	FIELDS = OrderedDict([
		("FAVOURITE_ID", "INTEGER"), ("TYPE", "TEXT"), ("MEDIA_ID", "INTEGER"),
		("FAVOURITE1", "TEXT"), ("FAVOURITE2", "TEXT"), ("FAVOURITE3", "TEXT"),
		("FAVOURITE4", "TEXT"), ("FAVOURITE5", "TEXT"),
	])
	DEFAULTS = {

	}


class MountDevice(DatabaseItem):
	TABLE = "MOUNT_DEVICE"
	FIELDS = OrderedDict([
		("MOUNT_DEVICE_ID", "INTEGER"), ("UUID", "TEXT"), ("MOUNT_POINT", "TEXT"),
		("STATUS", "INTEGER"),
	])
	DEFAULTS = {
		"STATUS" : "0"
	}


class Music(DatabaseItem):
	TABLE = "MUSIC"
	FIELDS = OrderedDict([
		("MUSIC_ID", "INTEGER"), ("MUSIC_ALBUM_ID", "INTEGER"), ("TITLE", "TEXT"),
		("SEARCH_TITLE", "TEXT"), ("PATH", "TEXT"), ("DETAIL_POSTER", "TEXT"),
		("THUMBNAIL", "TEXT"), ("RUNTIME", "INTEGER"), ("FORMAT", "TEXT"),
		("LYRIC", "TEXT"), ("RATING", "INTEGER"), ("SIZE", "INTEGER"),
		("SAMPLING", "INTEGER"), ("PLAY_COUNT", "INTEGER"), ("BIT_RATE", "TEXT"),
		("CREATE_TIME", "TEXT"), ("UPDATE_STATE", "INTEGER"), ("MOUNT_DEVICE_ID", "INTEGER"),
		("MUSIC1", "TEXT"), ("MUSIC2", "TEXT"), ("MUSIC3", "TEXT"),
		("MUSIC4", "TEXT"), ("MUSIC5", "TEXT"),
	])
	DEFAULTS = {
		"PLAY_COUNT" : "0",
		"RATING" : "0"
	}


class MusicAlbum(DatabaseItem):
	TABLE = "MUSIC_ALBUM"
	FIELDS = OrderedDict([
		("MUSIC_ALBUM_ID", "INTEGER"), ("TITLE", "TEXT"), ("LANGUAGE", "TEXT"),
		("TOTAL_ITEM", "INTEGER"), ("SEARCH_TITLE", "TEXT"), ("RELEASE_DATE", "TEXT"),
		("DETAIL_POSTER", "TEXT"), ("THUMBNAIL", "TEXT"), ("UPDATE_STATE", "INTEGER"),
		("MUSIC_ALBUM1", "TEXT"), ("MUSIC_ALBUM2", "TEXT"), ("MUSIC_ALBUM3", "TEXT"),
		("MUSIC_ALBUM4", "TEXT"), ("MUSIC_ALBUM5", "TEXT"),
	])
	DEFAULTS = {
		"TOTAL_ITEM" : "0",
		"RELEASE_DATE" : "9999-01-01"
	}


class MusicAttr(DatabaseItem):
	TABLE = "MUSIC_ATTR"
	FIELDS = OrderedDict([
		("MUSIC_ATTR_ID", "INTEGER"), ("MUSIC_ID", "INTEGER"), ("MUSIC_ALBUM_ID", "INTEGER"),
		("TYPE", "TEXT"), ("VALUE", "TEXT"), ("MUSIC_PERSON_ID", "INTEGER"),
		("LANGUAGE", "TEXT"), ("MUSIC_ATTR1", "TEXT"), ("MUSIC_ATTR2", "TEXT"),
		("MUSIC_ATTR3", "TEXT"), ("MUSIC_ATTR4", "TEXT"), ("MUSIC_ATTR5", "TEXT"),
	])
	DEFAULTS = {

	}


class MusicGroup(DatabaseItem):
	TABLE = "MUSIC_GROUP"
	FIELDS = OrderedDict([
		("MUSIC_GROUP_ID", "INTEGER"), ("MUSIC_GROUP_NAME_ID", "TEXT"), ("MUSIC_ID", "INTEGER"),
		("MUSIC_ALBUM_ID", "INTEGER"), ("MUSIC_GROUP1", "TEXT"), ("MUSIC_GROUP2", "TEXT"),
		("MUSIC_GROUP3", "TEXT"), ("MUSIC_GROUP4", "TEXT"), ("MUSIC_GROUP5", "TEXT"),
	])
	DEFAULTS = {

	}


class MusicGroupName(DatabaseItem):
	TABLE = "MUSIC_GROUP_NAME"
	FIELDS = OrderedDict([
		("MUSIC_GROUP_NAME_ID", "INTEGER"), ("NAME", "TEXT"), ("LANGUAGE", "TEXT"),
		("MUSIC_GROUP_NAME1", "TEXT"), ("MUSIC_GROUP_NAME2", "TEXT"), ("MUSIC_GROUP_NAME3", "TEXT"),
		("MUSIC_GROUP_NAME4", "TEXT"), ("MUSIC_GROUP_NAME5", "TEXT"),
	])
	DEFAULTS = {

	}


class MusicLastOpen(DatabaseItem):
	TABLE = "MUSIC_LAST_OPEN"
	FIELDS = OrderedDict([
		("MUSIC_LAST_OPEN_ID", "INTEGER"), ("MUSIC_ID", "INTEGER"), ("CREATE_TIME", "TEXT"),
		("MUSIC_LAST_OPEN1", "TEXT"), ("MUSIC_LAST_OPEN2", "TEXT"), ("MUSIC_LAST_OPEN3", "TEXT"),
		("MUSIC_LAST_OPEN4", "TEXT"), ("MUSIC_LAST_OPEN5", "TEXT"),
	])
	DEFAULTS = {

	}


class MusicPerson(DatabaseItem):
	TABLE = "MUSIC_PERSON"
	FIELDS = OrderedDict([
		("MUSIC_PERSON_ID", "INTEGER"), ("NAME", "TEXT"), ("THUMBNAIL", "TEXT"),
		("BIOGRAPHY", "TEXT"), ("EXTRA_INFO", "TEXT"), ("MUSIC_PERSON1", "TEXT"),
		("MUSIC_PERSON2", "TEXT"), ("MUSIC_PERSON3", "TEXT"), ("MUSIC_PERSON4", "TEXT"),
		("MUSIC_PERSON5", "TEXT"),
	])
	DEFAULTS = {

	}


class MusicPls(DatabaseItem):
	TABLE = "MUSIC_PLS"
	FIELDS = OrderedDict([
		("MUSIC_PLS_ID", "INTEGER"), ("NAME", "TEXT"), ("PATH", "TEXT"),
		("TOTAL_ITEM", "INTEGER"), ("CREATE_TIME", "TEXT"), ("MOUNT_DEVICE_ID", "INTEGER"),
		("MUSIC_PLS1", "TEXT"), ("MUSIC_PLS2", "TEXT"), ("MUSIC_PLS3", "TEXT"),
		("MUSIC_PLS4", "TEXT"), ("MUSIC_PLS5", "TEXT"),
	])
	DEFAULTS = {

	}


class MusicPlsItem(DatabaseItem):
	TABLE = "MUSIC_PLS_ITEM"
	FIELDS = OrderedDict([
		("MUSIC_PLS_ITEM_ID", "INTEGER"), ("MUSIC_PLS_ID", "INTEGER"), ("MUSIC_ID", "INTEGER"),
		("SEQUENCE", "INTEGER"), ("MUSIC_PLS_ITEM1", "TEXT"), ("MUSIC_PLS_ITEM2", "TEXT"),
		("MUSIC_PLS_ITEM3", "TEXT"), ("MUSIC_PLS_ITEM4", "TEXT"), ("MUSIC_PLS_ITEM5", "TEXT"),
	])
	DEFAULTS = {

	}


class MusicSynopsis(DatabaseItem):
	TABLE = "MUSIC_SYNOPSIS"
	FIELDS = OrderedDict([
		("MUSIC_SYNOPSIS_ID", "INTEGER"), ("MUSIC_ALBUM_ID", "INTEGER"), ("LANGUAGE", "TEXT"),
		("CONTENT", "TEXT"), ("MUSIC_SYNOPSIS1", "TEXT"), ("MUSIC_SYNOPSIS2", "TEXT"),
		("MUSIC_SYNOPSIS3", "TEXT"), ("MUSIC_SYNOPSIS4", "TEXT"), ("MUSIC_SYNOPSIS5", "TEXT"),
	])
	DEFAULTS = {

	}


class Photo(DatabaseItem):
	TABLE = "PHOTO"
	FIELDS = OrderedDict([
		("PHOTO_ID", "INTEGER"), ("TITLE", "TEXT"), ("SEARCH_TITLE", "TEXT"),
		("PATH", "TEXT"), ("THUMBNAIL", "TEXT"), ("PREVIEW", "TEXT"),
		("FORMAT", "TEXT"), ("WIDTH", "TEXT"), ("HEIGHT", "TEXT"),
		("CAPTURE_TIME", "TEXT"), ("APERTURE_VALUE", "TEXT"), ("F_NUMBER", "TEXT"),
		("SHUTTLE_SPEED", "TEXT"), ("FOCAL_LENGTH", "TEXT"), ("ISO_SPEED", "TEXT"),
		("COLOR_SPACE", "TEXT"), ("FLASH", "TEXT"), ("MODEL", "TEXT"),
		("SIZE", "INTEGER"), ("CREATE_TIME", "TEXT"), ("UPDATE_STATE", "INTEGER"),
		("MOUNT_DEVICE_ID", "INTEGER"), ("PHOTO1", "TEXT"), ("PHOTO2", "TEXT"),
		("PHOTO3", "TEXT"), ("PHOTO4", "TEXT"), ("PHOTO5", "TEXT"),
	])
	DEFAULTS = {
		"CAPTURE_TIME" : "9999-01-01"
	}


class PhotoAlbum(DatabaseItem):
	TABLE = "PHOTO_ALBUM"
	FIELDS = OrderedDict([
		("PHOTO_ALBUM_ID", "INTEGER"), ("TITLE", "TEXT"), ("SEARCH_TITLE", "TEXT"),
		("PATH", "TEXT"), ("TOTAL_ITEM", "INTEGER"), ("CREATE_TIME", "TEXT"),
		("MOUNT_DEVICE_ID", "INTEGER"), ("PHOTO_ALBUM1", "TEXT"), ("PHOTO_ALBUM2", "TEXT"),
		("PHOTO_ALBUM3", "TEXT"), ("PHOTO_ALBUM4", "TEXT"), ("PHOTO_ALBUM5", "TEXT"),
	])
	DEFAULTS = {

	}


class PhotoAlbumItem(DatabaseItem):
	TABLE = "PHOTO_ALBUM_ITEM"
	FIELDS = OrderedDict([
		("PHOTO_ALBUM_ITEM_ID", "INTEGER"), ("PHOTO_ALBUM_ID", "INTEGER"), ("PHOTO_ID", "INTEGER"),
		("SEQUENCE", "INTEGER"), ("PHOTO_ALBUM_ITEM1", "TEXT"), ("PHOTO_ALBUM_ITEM2", "TEXT"),
		("PHOTO_ALBUM_ITEM3", "TEXT"), ("PHOTO_ALBUM_ITEM4", "TEXT"), ("PHOTO_ALBUM_ITEM5", "TEXT"),
	])
	DEFAULTS = {

	}


class PhotoAttr(DatabaseItem):
	TABLE = "PHOTO_ATTR"
	FIELDS = OrderedDict([
		("PHOTO_ATTR_ID", "INTEGER"), ("PHOTO_ID", "INTEGER"), ("PHOTO_ALBUM_ID", "INTEGER"),
		("TYPE", "TEXT"), ("VALUE", "TEXT"), ("PHOTO_ATTR1", "TEXT"),
		("PHOTO_ATTR2", "TEXT"), ("PHOTO_ATTR3", "TEXT"), ("PHOTO_ATTR4", "TEXT"),
		("PHOTO_ATTR5", "TEXT"),
	])
	DEFAULTS = {

	}


class PhotoDate(DatabaseItem):
	TABLE = "PHOTO_DATE"
	FIELDS = OrderedDict([
		("PHOTO_DATE_ID", "INTEGER"), ("CAPTURE_TIME", "TEXT"), ("TOTAL_ITEM", "INT"),
		("PHOTO_DATE1", "TEXT"), ("PHOTO_DATE2", "TEXT"), ("PHOTO_DATE3", "TEXT"),
		("PHOTO_DATE4", "TEXT"), ("PHOTO_DATE5", "TEXT"),
	])
	DEFAULTS = {

	}


class PhotoLastOpen(DatabaseItem):
	TABLE = "PHOTO_LAST_OPEN"
	FIELDS = OrderedDict([
		("PHOTO_LAST_OPEN_ID", "INTEGER"), ("PHOTO_ID", "INTEGER"), ("CREATE_TIME", "TEXT"),
		("PHOTO_LAST_OPEN1", "TEXT"), ("PHOTO_LAST_OPEN2", "TEXT"), ("PHOTO_LAST_OPEN3", "TEXT"),
		("PHOTO_LAST_OPEN4", "TEXT"), ("PHOTO_LAST_OPEN5", "TEXT"),
	])
	DEFAULTS = {

	}


class ScanDirs(DatabaseItem):
	TABLE = "SCAN_DIRS"
	FIELDS = OrderedDict([
		("DIR_ID", "INTEGER"), ("DIRECTORY", "TEXT"), ("NAME", "TEXT"),
		("SCAN_TIME", "TEXT"), ("SIZE", "INTEGER"),
		("CATEGORY", "INTEGER"), ("SCAN_DIRS1", "TEXT"), ("SCAN_DIRS2", "TEXT"),
		("SCAN_DIRS3", "TEXT"), ("SCAN_DIRS4", "TEXT"), ("SCAN_DIRS5", "TEXT"),
	])
	DEFAULTS = {

	}


class ScanSystem(DatabaseItem):
	TABLE = "SCAN_SYSTEM"
	FIELDS = OrderedDict([
		("SYSTEM_ID", "INTEGER"), ("TYPE", "TEXT"), ("VALUE", "TEXT"),
		("SCAN_SYSTEM1", "TEXT"), ("SCAN_SYSTEM2", "TEXT"), ("SCAN_SYSTEM3", "TEXT"),
		("SCAN_SYSTEM4", "TEXT"), ("SCAN_SYSTEM5", "TEXT"),
	])
	DEFAULTS = {

	}


class Show(DatabaseItem):
	TABLE = "SHOW"
	FIELDS = OrderedDict([
		("SHOW_ID", "INTEGER"), ("TITLE", "TEXT"), ("SEARCH_TITLE", "TEXT"),
		("LAST_PLAY_ITEM", "INTEGER"), ("TOTAL_ITEM", "INTEGER"),
		("RELEASE_DATE", "TEXT"), ("DETAIL_POSTER", "TEXT"), ("THUMBNAIL", "TEXT"),
		("RATING", "INTEGER"), ("RESOLUTION", "TEXT"), ("WIDTH", "TEXT"),
		("HEIGHT", "TEXT"), ("PARENTAL_RATING", "TEXT"), ("SYSTEM", "TEXT"),
		("VIDEO_CODEC", "TEXT"), ("FPS", "TEXT"), ("CREATE_TIME", "TEXT"),
		("SHOW_TYPE", "INTEGER"), ("WALLPAPER", "TEXT"), ("CAST_ID", "TEXT"),
		("UPDATE_STATE", "INTEGER"), ("TTID", "TEXT"), ("TOTAL_EPISODES", "INTEGER"),
		("SHOW1", "TEXT"), ("SHOW2", "TEXT"), ("SHOW3", "TEXT"),
		("SHOW4", "TEXT"), ("SHOW5", "TEXT"),
	])
	DEFAULTS = {
		"RATING" : "0",
		"TOTAL_ITEM" : "0",
		"RELEASE_DATE" : "9999-01-01",
		"SHOW_TYPE" : "0"
	}

	@property
	def sortable_title(self):
		return re.sub('(le|la|un|une)(\s+)', '\2', self.title).strip()

	def __cmp__(self, other):
		if self.sortable_title < other.sortable_title:
			return -1
		elif self.sortable_title > other.sortable_title:
			return 1
		return 0

	def update_total_item(self, cursor):
		nb_items = Video.count(cursor, show_id=self.show_id)
		self.update(cursor, total_item=nb_items)
		return nb_items


class Video(DatabaseItem):
	TABLE = "VIDEO"
	FIELDS = OrderedDict([
		("VIDEO_ID", "INTEGER"), ("TITLE", "TEXT"), ("SEARCH_TITLE", "TEXT"),
		("RELEASE_DATE", "TEXT"), ("PATH", "TEXT"), ("DETAIL_POSTER", "TEXT"),
		("THUMBNAIL", "TEXT"), ("RUNTIME", "INTEGER"), ("RATING", "INTEGER"),
		("RESOLUTION", "TEXT"), ("WIDTH", "TEXT"), ("HEIGHT", "TEXT"),
		("ASPECT_RATIO", "TEXT"), ("PARENTAL_RATING", "TEXT"), ("SYSTEM", "TEXT"),
		("VIDEO_CODEC", "TEXT"), ("FPS", "INTEGER"), ("SIZE", "INTEGER"),
		("PLAY_COUNT", "INTEGER"), ("SHOW_ID", "INTEGER"), ("EPISODE", "INTEGER"),
		("CREATE_TIME", "TEXT"), ("WALLPAPER", "TEXT"), ("CAST_ID", "TEXT"),
		("UPDATE_STATE", "INTEGER"), ("MOUNT_DEVICE_ID", "INTEGER"), ("SEASON", "INTEGER"),
		("TTID", "TEXT"), ("TITLE_TYPE", "TEXT"), ("VIDEO1", "TEXT"),
		("VIDEO2", "TEXT"), ("VIDEO3", "TEXT"), ("VIDEO4", "TEXT"),
		("VIDEO5", "TEXT"),
	])
	DEFAULTS = {
		"PLAY_COUNT" : "0",
		"RATING" : "0",
		"RELEASE_DATE" : "9999-01-01"
	}


class VideoAttr(DatabaseItem):
	TABLE = "VIDEO_ATTR"
	FIELDS = OrderedDict([
		("VIDEO_ATTR_ID", "INTEGER"), ("VIDEO_ID", "INTEGER"), ("SHOW_ID", "INTEGER"),
		("TYPE", "TEXT"), ("VALUE", "TEXT"), ("VIDEO_PERSON_ID", "INTEGER"),
		("LANGUAGE", "TEXT"), ("VIDEO_ATTR1", "TEXT"), ("VIDEO_ATTR2", "TEXT"),
		("VIDEO_ATTR3", "TEXT"), ("VIDEO_ATTR4", "TEXT"), ("VIDEO_ATTR5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoBookmark(DatabaseItem):
	TABLE = "VIDEO_BOOKMARK"
	FIELDS = OrderedDict([
		("VIDEO_BOOKMARK_ID", "INTEGER"), ("VIDEO_ID", "INTEGER"), ("BOOKMARK_TIME", "INTEGER"),
		("THUMBNAIL", "TEXT"), ("VIDEO_BOOKMARK1", "TEXT"), ("VIDEO_BOOKMARK2", "TEXT"),
		("VIDEO_BOOKMARK3", "TEXT"), ("VIDEO_BOOKMARK4", "TEXT"), ("VIDEO_BOOKMARK5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoChapter(DatabaseItem):
	TABLE = "VIDEO_CHAPTER"
	FIELDS = OrderedDict([
		("VIDEO_CHAPTER_ID", "INTEGER"), ("VIDEO_ID", "INTEGER"), ("TITLE", "TEXT"),
		("CHAPTER_POINT", "INTEGER"), ("THUMBNAIL", "TEXT"), ("TYPE", "INTEGER"),
		("VIDEO_CHAPTER1", "TEXT"), ("VIDEO_CHAPTER2", "TEXT"), ("VIDEO_CHAPTER3", "TEXT"),
		("VIDEO_CHAPTER4", "TEXT"), ("VIDEO_CHAPTER5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoGenre(DatabaseItem):
	TABLE = "VIDEO_GENRE"
	FIELDS = OrderedDict([
		("VIDEO_GENRE_ID", "INTEGER"), ("VIDEO_SHOW_ID", "INTEGER"), ("GENRE", "TEXT"),
		("TYPE", "INTEGER"), ("VIDEO_GENRE1", "TEXT"), ("VIDEO_GENRE2", "TEXT"),
		("VIDEO_GENRE3", "TEXT"), ("VIDEO_GENRE4", "TEXT"), ("VIDEO_GENRE5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoGroup(DatabaseItem):
	TABLE = "VIDEO_GROUP"
	FIELDS = OrderedDict([
		("VIDEO_GROUP_ID", "INTEGER"), ("VIDEO_GROUP_NAME_ID", "INTEGER"), ("VIDEO_ID", "INTEGER"),
		("SHOW_ID", "INTEGER"), ("PARENTAL_RATING", "TEXT"), ("SHOW_TYPE", "INTEGER"),
		("VIDEO_GROUP1", "TEXT"), ("VIDEO_GROUP2", "TEXT"), ("VIDEO_GROUP3", "TEXT"),
		("VIDEO_GROUP4", "TEXT"), ("VIDEO_GROUP5", "TEXT"),
	])
	DEFAULTS = {
		"SHOW_TYPE" : "0"
	}


class VideoGroupName(DatabaseItem):
	TABLE = "VIDEO_GROUP_NAME"
	FIELDS = OrderedDict([
		("VIDEO_GROUP_NAME_ID", "INTEGER"), ("NAME", "TEXT"), ("LANGUAGE", "TEXT"),
		("VIDEO_GROUP_NAME1", "TEXT"), ("VIDEO_GROUP_NAME2", "TEXT"), ("VIDEO_GROUP_NAME3", "TEXT"),
		("VIDEO_GROUP_NAME4", "TEXT"), ("VIDEO_GROUP_NAME5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoLastOpen(DatabaseItem):
	TABLE = "VIDEO_LAST_OPEN"
	FIELDS = OrderedDict([
		("VIDEO_LAST_OPEN_ID", "INTEGER"), ("VIDEO_ID", "INTEGER"), ("SHOW_ID", "INTEGER"),
		("CREATE_TIME", "TEXT"), ("VIDEO_LAST_OPEN1", "TEXT"), ("VIDEO_LAST_OPEN2", "TEXT"),
		("VIDEO_LAST_OPEN3", "TEXT"), ("VIDEO_LAST_OPEN4", "TEXT"), ("VIDEO_LAST_OPEN5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoPerson(DatabaseItem):
	TABLE = "VIDEO_PERSON"
	FIELDS = OrderedDict([
		("VIDEO_PERSON_ID", "INTEGER"), ("NAME", "TEXT"), ("THUMBNAIL", "TEXT"),
		("BIOGRAPHY", "TEXT"), ("EXTRA_INFO", "TEXT"), ("VIDEO_PERSON1", "TEXT"),
		("VIDEO_PERSON2", "TEXT"), ("VIDEO_PERSON3", "TEXT"), ("VIDEO_PERSON4", "TEXT"),
		("VIDEO_PERSON5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoPls(DatabaseItem):
	TABLE = "VIDEO_PLS"
	FIELDS = OrderedDict([
		("VIDEO_PLS_ID", "INTEGER"), ("NAME", "TEXT"), ("LAST_PLAY_ITEM", "INTEGER"),
		("TOTAL_ITEM", "INTEGER"), ("CREATE_TIME", "TEXT"), ("VIDEO_PLS1", "TEXT"),
		("VIDEO_PLS2", "TEXT"), ("VIDEO_PLS3", "TEXT"), ("VIDEO_PLS4", "TEXT"),
		("VIDEO_PLS5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoPlsItem(DatabaseItem):
	TABLE = "VIDEO_PLS_ITEM"
	FIELDS = OrderedDict([
		("VIDEO_PLS_ITEM_ID", "INTEGER"), ("VIDEO_PLS_ID", "INTEGER"), ("VIDEO_ID", "INTEGER"),
		("SEQUENCE", "INTEGER"), ("VIDEO_PLS_ITEM1", "TEXT"), ("VIDEO_PLS_ITEM2", "TEXT"),
		("VIDEO_PLS_ITEM3", "TEXT"), ("VIDEO_PLS_ITEM4", "TEXT"), ("VIDEO_PLS_ITEM5", "TEXT"),
	])
	DEFAULTS = {

	}


class VideoSynopsis(DatabaseItem):
	TABLE = "VIDEO_SYNOPSIS"
	FIELDS = OrderedDict([
		("VIDEO_SYNOPSIS_ID", "INTEGER"), ("VIDEO_ID", "INTEGER"), ("SHOW_ID", "INTEGER"),
		("LANGUAGE", "TEXT"), ("CONTENT", "TEXT"), ("VIDEO_SYNOPSIS1", "TEXT"),
		("VIDEO_SYNOPSIS2", "TEXT"), ("VIDEO_SYNOPSIS3", "TEXT"), ("VIDEO_SYNOPSIS4", "TEXT"),
		("VIDEO_SYNOPSIS5", "TEXT"),
	])
	DEFAULTS = {

	}

ALL_TABLES = [
	App,
	AppCategory,
	AppToCategory,
	DbVersion,
	Favourite,
	MountDevice,
	Music,
	MusicAlbum,
	MusicAttr,
	MusicGroup,
	MusicGroupName,
	MusicLastOpen,
	MusicPerson,
	MusicPls,
	MusicPlsItem,
	MusicSynopsis,
	Photo,
	PhotoAlbum,
	PhotoAlbumItem,
	PhotoAttr,
	PhotoDate,
	PhotoLastOpen,
	ScanDirs,
	ScanSystem,
	Show,
	Video,
	VideoAttr,
	VideoBookmark,
	VideoChapter,
	VideoGenre,
	VideoGroup,
	VideoGroupName,
	VideoLastOpen,
	VideoPerson,
	VideoPls,
	VideoPlsItem,
	VideoSynopsis
]

